package com.nue.controller;


import com.nue.pojo.UmsRole;
import com.nue.pojo.UmsUser;
import com.nue.service.IUmsRoleService;
import com.nue.util.CommonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 角色表 前端控制器
 * </p>
 *
 * @author wk
 * @since 2020-08-19
 */
@RestController
@RequestMapping("/ums-role")
public class UmsRoleController {
    @Resource
    IUmsRoleService umsRoleService;


    @GetMapping("list")
    CommonResult list(UmsRole user){
        return umsRoleService.list(user);
    }
    @GetMapping("getById")
    CommonResult getById(UmsRole user){
        return CommonResult.success(umsRoleService.getById(user.getId()));
    }
    @PostMapping("add")
    CommonResult save(UmsRole user){
        System.out.println("此时的user"+user);
        return umsRoleService.saveOne(user);
    }
    @PostMapping("update")
    CommonResult update(UmsRole user){
        System.out.println("此时的user"+user);
        return umsRoleService.update(user);
    }
    @PostMapping("back")
    CommonResult back(Integer id){
        return umsRoleService.back(id);
    }
    @PostMapping("del")
    CommonResult del(Integer id){
        return umsRoleService.del(id);
    }
    @PostMapping("/batchdel")
    CommonResult batchdel(Integer[] ids) {
        return CommonResult.success(umsRoleService.batchdel(ids));
    }

}
